package ar.edu.taxi.persistencia;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DTOTrips implements IfDTO{

	private int id;
	private Date reserveDate;
	private Date tripDate;
	private Date startDate;
	private Date finishDate;
	private double fromLat;
	private double fromLon;
	private double toLat;
	private double toLon;
	private int idDriver;
	private int idVehicle;
	private int idPassanger;
	private int idState;
	
	public DTOTrips() {
		// TODO Auto-generated constructor stub
	}
	
	public DTOTrips(int id, Date reserveDate, Date tripDate, Date startDate, Date finishDate,
			double fromLat, double fromLon, double toLat, double toLon, int idDriver,
			int idVehicle, int idPassanger, int idState){
		this.id = id;
		this.reserveDate = reserveDate;
		this.tripDate = tripDate;
		this.startDate = startDate;
		this.finishDate = finishDate;
		this.fromLat = fromLat;
		this.fromLon = fromLon;
		this.toLat = toLat;
		this.toLon = toLon;
		this.idDriver = idDriver;
		this.idVehicle = idVehicle;
		this.idPassanger = idPassanger;
		this.idState = idState;
	}
	
	

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getReserveDate() {
		return reserveDate;
	}
	
	public String getReserveDateToString(){
		SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return d.format(reserveDate);
	}

	public void setReserveDate(Date reserveDate) {
		this.reserveDate = reserveDate;
	}
	
	public void setReserveDate(String date){
		SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		try {
			this.reserveDate = d.parse(date);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public Date getTripDate() {
		return tripDate;
	}
	
	public String getTripToString(){
		SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return d.format(tripDate);
	}

	public void setTripDate(Date tripDate) {
		this.tripDate = tripDate;
	}
	
	public void setTripDate(String date){
		SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		try {
			this.tripDate = d.parse(date);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public Date getStartDate() {
		return startDate;
	}
	
	public String getStartDateToString(){
		SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return d.format(startDate);
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}
	
	public void setStartDate(String date){
		SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		try {
			this.startDate = d.parse(date);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public Date getFinishDate() {
		return finishDate;
	}

	public String getFinishDateToString(){
		SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return d.format(finishDate);
	}
	
	public void setFinishDate(Date finishDate) {
		this.finishDate = finishDate;
	}
	
	public void setFinishDate(String date){
		SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		try {
			this.finishDate = d.parse(date);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public double getFromLat() {
		return fromLat;
	}

	public void setFromLat(double fromLat) {
		this.fromLat = fromLat;
	}

	public double getFromLon() {
		return fromLon;
	}

	public void setFromLon(double fromLon) {
		this.fromLon = fromLon;
	}

	public double getToLat() {
		return toLat;
	}

	public void setToLat(double toLat) {
		this.toLat = toLat;
	}

	public double getToLon() {
		return toLon;
	}

	public void setToLon(double toLon) {
		this.toLon = toLon;
	}

	public int getIdDriver() {
		return idDriver;
	}

	public void setIdDriver(int idDriver) {
		this.idDriver = idDriver;
	}

	public int getIdVehicle() {
		return idVehicle;
	}

	public void setIdVehicle(int idVehicle) {
		this.idVehicle = idVehicle;
	}

	public int getIdPassanger() {
		return idPassanger;
	}

	public void setIdPassanger(int idPassanger) {
		this.idPassanger = idPassanger;
	}

	public int getIdState() {
		return idState;
	}

	public void setIdState(int idState) {
		this.idState = idState;
	}

	@Override
	public boolean isEquals(IfDTO bean) {
		// TODO Auto-generated method stub
		return (this.id == ((DTOTrips)bean).getId());
	}

}
